<div class="row">
	<div class="col-lg-12 col-sm-12 col-xs-12">

		<div class="">
			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12 text-center">
					<h3 class="print"> 山东箭波通信设备有限公司 </h3>
					<% if @contract.contract_type == "SALE" %>
						<h3 class="print"> 产品采购合同 </h3>
					<% else %>
						<h3 class="print"> 产品销售合同 </h3>
					<% end %>
					
				</div>
			</div>
			
			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12 text-center">
					<table class="border-less" >
						<tr>
							<td class="text-right"></td>
							<td class="col-md-4 text-left"></td>

							<td class="col-md-2 text-right"><span>合同日期:</span></td>
							<td class="col-md-4 text-left"><span><%= @contract.contract_date %></span></td>
						</tr>
						<tr>
							<td class="text-right"><span>供方:</span></td>
							<td class="col-md-4 text-left"><%= @contract.seller  %> </td>

							<td class="col-md-2 text-right"><span>合同编号:</span></td>
							<td class="col-md-4 text-left"><span><%= @contract.contract_code %></span></td>
						</tr>
						<tr>
							<td class="text-right"><span>需方:</span></td>
							<td class="col-md-4 text-left"><span><%= @contract.buyer %></span></td>
							<td class="col-md-2 text-right"><span>履行地点:</span></td>
							<td class="col-md-4 text-left"><span><%= @contract.place_of_fulfil %></span></td>
						</tr>
					</table>
				</div>
							
			</div>
			<div class="horizontal-space"></div>
			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<p>
						为保护供需双方的合法权益，根据《中华人民共和国合同法》，双方在自愿、平等、友好协商的基础上，特订立本合同，双方共同遵照执行：
					</p>
					<p>
						一、产品名称、规格型号、数量、价格、金额
					</p>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<!-- / end client details section -->
					<table id="invoice" class="table table-bordered">
						<thead>
							<tr>
								<th class="w-5">序号</th>
								<th class="w-20">产品名称</th>
								<th class="w-20">规格型号</th>
								<th class="w-5">单位</th>
								<th class="w-10">数量</th>
								<th class="w-10">单价（元）</th>
								<th class="w-10">金额</th>
								<th class="w-20">备注</th>

							</tr>
						</thead>
						<tbody>
							<% index = 1 %>
							<% @contract.contract_items.each do |i| %>
								<tr>
									<td><%= index %></td>
									<td><%= i.product_name %></td>
									<td><%= i.product_desc %></td>
									<td><%= i.unit %></td>
									<td><%= i.quantity %></td>
									<td><%= i.unit_price %></td>
									<td><%= i.amount %></td>
									<td><%= i.comment %></td>
								</tr>
								<% index += 1 %>
							<% end %>
						</tbody>
						<tfoot>
							<tr>
								<td colspan="6">总价: 人民币大写 <%= decimal_to_Yuan(@contract.total) %></td>
								<td><%= @contract.total %></td>
								<td> </td>
							</tr>
							<tr>
								<td colspan="8">备注：
								<%= @contract.comment %>
								</td>
							</tr>
						</tfoot>
					</table>					
				</div>
			</div>

			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<% if @contract.contract_type == "销售合同" %>
						<%= render "sale_contract"%>
					<% else %>
						<%= render "purchase_contract" %>
					<% end %>					
				</div>
			</div>

			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<table class="table table-bordered">
						<tr>
							<td class="w-50">
							<ul>
								<li>
									供方单位：
									<%= @contract.seller  %>
								</li>
								<li>
									单位地址: <%= @contract.seller_address %>

								</li>
								<li>
									委托代理人: <%= @contract.seller_agent %>
								</li>
								<li>
									电话: <%= @contract.seller_tel %>
								</li>
								<li>
									传真：<%= @contract.seller_fax %>
								</li>
								<li>
									开户银行: <%= @contract.seller_bank %>
								</li>
								<li>
									账号: <%= @contract.seller_bank_account %>
								</li>

							</ul></td>
							<td>
							<ul>
								<li>
									需方单位：<%= @contract.buyer%>
								</li>
								<li>
									单位地址: <%= @contract.buyer_address %>
								</li>
								<li>
									委托代理人: <%= @contract.buyer_agent %>
								</li>
								<li>
									电话: <%= @contract.buyer_tel %>
								</li>
								<li>
									传真：<%= @contract.buyer_fax %>
								</li>
								<li>
									开户银行: <%= @contract.buyer_bank %>
								</li>
								<li>
									账号: <%= @contract.buyer_bank_account %>
								</li>
							</ul></td>
						</tr>
					</table>
				</div>
			</div>

			
		</div>
	</div>
</div>

